home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / GoodBye / JohnKennedy / February96.lha / MASTERCLASS / MASTSEPT.LHA / mastsept.doc < prev   
Encoding:
Text File  |  1996-07-31  |  7.1 KB  |  229 lines

  1.  
  2. Continuing our look at the Workbench, we dealt with all the
  3. majority of the visible icons last month. Now we'll take a
  4. look at those files which don't have icons: they are all
  5. hidden until you get down to Shell level or use the "Show...
  6. All Files" Workbench menu option.
  7.  
  8. By the way, a program such as Directory Opus is particularly
  9. useful when it comes to exploring Workbench like this, as it
  10. allows you to move from directory to directory and examine
  11. the contents with only one or two clicks of the mouse.
  12.  
  13.  C
  14. ---
  15.  
  16. (m1.iff)
  17.  
  18.  
  19. The C directory is very important, as this is where all the
  20. AmigaDOS commands hang out. Most of the commands you can
  21. type at the Shell are really unique programs, and this is
  22. where they are stored. If you open a Shell window and enter:
  23.  
  24. cd c:
  25.  
  26. then you'll have moved from the default directory to the C
  27. directory. You can then type:
  28.  
  29. dir
  30.  
  31. to see a list of all the files present. (m2.iff) On older Workbench
  32. systems, the command "cd" was itself stored in this
  33. directory. Newer versions of the operating system, as used
  34. in Amiga 1200s for example, have this command -- and others
  35. -- built in to the OS Kickstart ROM. These commands are
  36. referred to as "resident". You can get a list of these
  37. resident commands by opening a shell and entering:
  38.  
  39. resident
  40.  
  41. The command will return a list of the built-in commands.
  42. It's also possible to temporarily make other commands
  43. resident too. You do this by including their full path and
  44. name after the command, like this:
  45.  
  46. resident c:list
  47.  
  48.  
  49.  
  50. Be Pure, Be Vigilent, Behave
  51. ----------------------------
  52.  
  53. Except this won't work and will return an error message --
  54. because the List command isn't totally "pure". Yes, another
  55. complication. A pure command is defined as one which is
  56. re-entrant and re-executable: in other words, it can be used
  57. again and again and several times at once without going
  58. wrong. In Workbench 3 almost all the commands which are Pure
  59. have already been made resident. You can check by using the
  60. list command, and watching out for the "p" flag appearing
  61. next to any filenames.
  62.  
  63. However, you can force a command to be made resident. In
  64. most cases this won't be a dangerous thing, but be aware of
  65. the potential for crashing if you multitask or run critical
  66. software: a bulletin board for example.
  67.  
  68. To force a command to become resident, no matter what, use
  69. the option Pure, like this:
  70.  
  71. resident c:list pure
  72.  
  73. This makes a command resident, and states that you are
  74. prepared to risk the consequences.
  75.  
  76. But why make a command resident in the first place? Speed is
  77. the answer: it can make long AmigaDOS scripts a lot faster
  78. if the Operating System doesn't need to spend most of the
  79. time tracking down the commands themselves. A good example
  80. is the startup-sequence. This script even forces several
  81. non-Pure commands resident in the quest for more speed. Look
  82. out for the line:
  83.  
  84. Resident >NIL: C:Assign PURE
  85.  
  86. and look out to see why the command doesn't remain resident
  87. after the script has ended. Resident commands also take up
  88. less memory that commands held, for example, in RAM disk. No
  89. matter how many times the command is executed only one
  90. instance of it is used at a time.
  91.  
  92. Here's a neat little trick. As resident needs the full path
  93. to a command, you can make use of the "which" command to
  94. discover it. At last! A use for "which"!
  95.  
  96. You can combine the "which" command with the resident
  97. operating using the "tick" (press the ordinary ' key whilst
  98. holding down ALT) to get something like this:
  99.  
  100. resident `which list` pure
  101.  
  102. Of course when you switch off the Amiga, the resident
  103. commands which you have created will all be lost.
  104.  
  105. (m3.iff)
  106.  
  107.  
  108.  
  109.  S
  110. ---
  111.  
  112. (m4.iff)
  113.  
  114.  
  115. The s directory is where Scripts are kept, or at least that
  116. was the intention. It's where you will find the
  117. startup-sequence file, and also the user-startup script too.
  118. After many years of use, my Amiga has amassed a staggering
  119. collection of junk in this directory as many programs have
  120. kindly installed useful scripts here for me.
  121.  
  122. The Art Department has left many files -- mostly in the form
  123. of ARexx programs -- and so have Spot, Mosaic and Cygnus Ed.
  124. Scripts don't take up a great deal of space, and so on a
  125. hard drive system these is little to be gained by deleting
  126. them. Some day they might be needed.
  127.  
  128. A script, by the way, is simply a text file containing
  129. AmigaDOS commands. You can write your own script using an
  130. text editor, including Ed the standard AmigaDOS editor.
  131. Simply add a list of the commands you wish to be used.
  132.  
  133. Using the script can be done in two ways. You can either use
  134. the "execute" AmigaDOS command like this:
  135.  
  136. execute s:my-script
  137.  
  138. Or you can alter one of the file's flags (special switches
  139. to tell the OS how to deal with the file -- like "Pure" for
  140. example) to define it as a script. If it's defined as a
  141. script, you only need to enter the name by itself, like
  142. this:
  143.  
  144. my-script
  145.  
  146. Here is how you would alter the flag to make an ordinary
  147. text file into a script:
  148.  
  149. protect s:my-script +S
  150.  
  151.  
  152. An ARexx script is slightly different in that it cannot be
  153. executed with the Execute command. It's not a list of
  154. AmigaDOS commands, but a program written in the ARexx
  155. language. We dealt with ARexx in some detail in previous
  156. Masterclass tutorials.
  157.  
  158.  
  159. (m5.iff) Using List you can check on the various flags
  160. associated with each file. You will probably has less files
  161. than I have: you will probably take more care to keep your
  162. hard disk tidy than I do!
  163.  
  164.  
  165.  
  166. libs
  167. ----
  168.  
  169. (m6.iff)
  170.  
  171.  
  172. The libs drawer is the default location for any Amiga
  173. libraries. A library in this sense is a file which contains
  174. various sub-routines. By storing the routines in a library,
  175. they are available to other programs and other multitasking
  176. copies of the same program.
  177.  
  178. Even the libs drawer of a new Amiga will contain a selection
  179. of libraries, including maths routines and ARexx code. After
  180. a while the directory will be stuffed with libraries as
  181. program after program adds it own routines to the list.
  182.  
  183. If you have deleted an unwanted application, have a quick
  184. look here to see if it has left a libary. Before you delete
  185. it for good, rename it and check if any other programs are
  186. making use of it.
  187.  
  188.  
  189.  
  190.  
  191.  
  192. box out: How does it do that?
  193.  
  194. You might be wondering how a command like "dir" can be
  195. executed when you aren't already in the directory in which
  196. it is stored.
  197.  
  198. For example, how come when you open a shell you can enter
  199. "dir" no matter if the default directory is Workbench or
  200. Ram:. You might have thought it would be necessary to
  201. include a full path, like  this:
  202.  
  203. cd ram:
  204. c:dir
  205.  
  206. However, a full path to the command is not needed, so this
  207. will work just as well:
  208.  
  209. cd ram:
  210. dir
  211.  
  212. A special command called "Path" makes this possible. If you
  213. look in the startup-sequence, you'll spot the rather heavy
  214. duty line:
  215.  
  216. Path >NIL: RAM: C: SYS:Utilities SYS:Rexxc SYS:System S:
  217. SYS:Prefs SYS:WBStartup SYS:Tools SYS:Tools/Commodities
  218.  
  219. This command sets up the paths which the operating system
  220. follows when it ecounters a command. When you enter an
  221. instruction such as "dir", the operating system first looks
  222. in the current directory (this is the default action). It
  223. then looks in "RAM:" then "C:" then "sys:utilities" and so on.
  224.  
  225. Before you ask, the Path command itself is a resident
  226. command and so it doesn't matter where it is stored!
  227.  
  228. -- end --
  229.